/* ************************************************************************

   Copyright:

   License:

   Authors:

 ************************************************************************ */

/* ************************************************************************

 #asset(secretcuz/*)

 ************************************************************************ */

/**
 * This is the main application class of your custom application "secretcuz"
 */
qx.Class.define("secretcuz.Application", {
	extend : qx.application.Inline,
	
	members : {
		tabView : null,
		bpProfilePage : null,
		bpManagePage : null,
		dashboardPage : null,
		settingPage : null,
		infoText : null,
		
		main : function() {
			// Call super class
			this.base(arguments);

			// Enable logging in debug variant
			if (qx.core.Environment.get("qx.debug")) {
				// support native logging capabilities, e.g. Firebug for Firefox
				qx.log.appender.Native;
				// support additional cross-browser console. Press F7 to toggle
				// visibility
				qx.log.appender.Console;
			}
			
			var container = new qx.ui.container.Composite(new qx.ui.layout.HBox(10));
			//container.setHeight(115);
			var label1 = new qx.ui.basic.Label().set({
				"rich"    : true,
				"value"   : "Online Portfolio of Tin Pham"
			});
			var label2 = new qx.ui.basic.Label().set({
				"rich"    : true,
				"value"   : "<a href='../index.html' style='text-decoration: none;'>HOME</a>"
			});
			var label3 = new qx.ui.basic.Label().set({
				"rich"    : true,
				"value"   : "<a href='../portfolio.html' style='text-decoration: none;'>PORTFOLIO</a>"
			});
			var label4 = new qx.ui.basic.Label().set({
				"rich"    : true,
				"value"   : "<a href='../blog.html' style='text-decoration: none;'>BLOG</a>"
			});
			container.add(label2);
			container.add(label3);
			container.add(label4);
//			this.getRoot().add(container, {top: 10, right: 10});
			
			this.infoText = new qx.ui.basic.Label("").set({
				rich : true
			});
//			this.getRoot().add(this.infoText, {top: 40, left: 200, right: 10});
			
			this.tabView = new qx.ui.tabview.TabView();
			this.tabView.addListener("changeSelection", function(e) {
				var page = e.getData()[0];
				if (this.bpManagePage != null && this.bpManagePage == page) {
					this.bpManagePage.populate();
				}
			}, this);
			//this.tabView.setBarPosition("left");

			this.bpProfilePage = new secretcuz.ui.BlogPostProfilePage();
			this.tabView.add(this.bpProfilePage);
			this.bpManagePage = new secretcuz.ui.BlogPostManagePage();
			this.tabView.add(this.bpManagePage);
			this.settingPage = new qx.ui.tabview.Page("Setting", "secretcuz/icons/setting.png");
			this.tabView.add(this.settingPage);
			this.dashboardPage = new qx.ui.tabview.Page("Dashboard", "secretcuz/icons/box.png");
			this.tabView.add(this.dashboardPage);
//			this.getRoot().add(this.tabView, {top: 80, bottom: 10, left: 10, right: 10});
			var isle1  = new qx.ui.root.Inline(document.getElementById("container"), false, true);
			isle1.setLayout(new qx.ui.layout.Grow());
			isle1.add(this.tabView);
		}
	}
});
